<html>
<head><meta charset="utf-8"><title>Rust is slow on raspberry pis · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html">Rust is slow on raspberry pis</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="222193971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222193971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222193971">(Jan 09 2021 at 23:00)</a>:</h4>
<p>rust in general is just super painful to compile on raspberry pis</p>



<a name="222193985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222193985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222193985">(Jan 09 2021 at 23:01)</a>:</h4>
<div class="codehilite"><pre><span></span><code>joshua@honey:~/YDBRust$ CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_OPT_LEVEL=0 cargo build --release --no-default-features
Compiling pkg-config v0.3.18
Compiling yottadb v1.1.0 (/home/joshua/YDBRust)
Finished release [optimized] target(s) in 5m 47s
</code></pre></div>



<a name="222193989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222193989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222193989">(Jan 09 2021 at 23:01)</a>:</h4>
<p>(for comparison, this is like 3 seconds on x86_64)</p>



<a name="222194037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222194037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222194037">(Jan 09 2021 at 23:02)</a>:</h4>
<p>I think it's serializing a lot of metadata or something</p>



<a name="222195339"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222195339" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222195339">(Jan 09 2021 at 23:40)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/246057-t-cargo/topic/Use.20in-memory.20index.20instead.20of.20writing.20to.20disk.3F/near/222193989">said</a>:</p>
<blockquote>
<p>(for comparison, this is like 3 seconds on x86_64)</p>
</blockquote>
<p>Any chance you can get a very rough profile of some kind, to figure out where the bulk of the time goes?</p>



<a name="222195352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222195352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222195352">(Jan 09 2021 at 23:41)</a>:</h4>
<p>(Even something as simple as an strace histogram might suffice.)</p>



<a name="222196218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222196218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222196218">(Jan 10 2021 at 00:00)</a>:</h4>
<p>What is an strace histogram?</p>



<a name="222196234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222196234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222196234">(Jan 10 2021 at 00:00)</a>:</h4>
<p>Happy to record anything that doesn't need me to install new tools; or if there's a way to parse it from strace output after the fact that works too</p>



<a name="222196286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222196286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222196286">(Jan 10 2021 at 00:02)</a>:</h4>
<p>I can definitely say without detailed measurements that the biggest time sinks are updating the index, running rustc, and overhead from cargo, in that order</p>



<a name="222198208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222198208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222198208">(Jan 10 2021 at 01:01)</a>:</h4>
<p><a href="/user_uploads/4715/h0hhXataoKRobyJXJ0FrqvME/cargo-timing-20210110T005425Z.html">cargo-timing-20210110T005425Z.html</a></p>



<a name="222198329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222198329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222198329">(Jan 10 2021 at 01:04)</a>:</h4>
<p>^ that's time spent on rustc, there's a good 15 seconds of cargo overhead to go with it</p>



<a name="222198363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222198363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222198363">(Jan 10 2021 at 01:05)</a>:</h4>
<p>lol <code>-Z self-profile</code> can't even start up</p>
<div class="codehilite"><pre><span></span><code>warning: failed to create profiler: Cannot allocate memory (os error 12)
</code></pre></div>



<a name="222198691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222198691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222198691">(Jan 10 2021 at 01:14)</a>:</h4>
<p>also something is <em>very</em> wrong with -Z time-passes because these are taking multiple seconds each and say they're not</p>
<div class="codehilite"><pre><span></span><code>time: 0.007; rss: 135MB LLVM_module_optimize_function_passes(pkg_config.2il65vya-cgu.3)
time: 0.023; rss: 135MB LLVM_module_optimize_module_passes(pkg_config.2il65vya-cgu.3)
time: 0.004; rss: 135MB LLVM_module_optimize_function_passes(pkg_config.2il65vya-cgu.4)
time: 0.170; rss: 135MB LLVM_module_optimize_module_passes(pkg_config.2il65vya-cgu.4)
</code></pre></div>



<a name="222198765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222198765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222198765">(Jan 10 2021 at 01:16)</a>:</h4>
<p>yeah, there were 14 of those and the overall time was</p>
<div class="codehilite"><pre><span></span><code>time: 126.362; rss: 107MB   LLVM_passes(crate)
</code></pre></div>



<a name="222198849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222198849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222198849">(Jan 10 2021 at 01:18)</a>:</h4>
<p>probably it's not timing how long it takes to write this to disk</p>



<a name="222198859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222198859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222198859">(Jan 10 2021 at 01:18)</a>:</h4>
<p>I wonder if it could buffer these and write all the object files at once</p>



<a name="222198862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222198862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222198862">(Jan 10 2021 at 01:18)</a>:</h4>
<p>that would speed it up significantly I think</p>



<a name="222198963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222198963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222198963">(Jan 10 2021 at 01:21)</a>:</h4>
<div class="codehilite"><pre><span></span><code>time: 69.528; rss: 76MB expand_crate
</code></pre></div>
<p>oh wow I did not expect that</p>



<a name="222199233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222199233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222199233">(Jan 10 2021 at 01:28)</a>:</h4>
<p>Didn't see pkg-config data anywhere, presumably because the profiler ran out of memory<br>
<a href="/user_uploads/4715/Cfh1G6R8bV_zHYd3yRtHJD2k/yottadb-9604.string_data">yottadb-9604.string_data</a> <a href="/user_uploads/4715/bnLNhMdWNKwCUmGboSIbwqES/yottadb-9604.events">yottadb-9604.events</a></p>



<a name="222199302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222199302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222199302">(Jan 10 2021 at 01:30)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis/near/222195339">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/246057-t-cargo/topic/Use.20in-memory.20index.20instead.20of.20writing.20to.20disk.3F/near/222193989">said</a>:</p>
<blockquote>
<p>(for comparison, this is like 3 seconds on x86_64)</p>
</blockquote>
<p>Any chance you can get a very rough profile of some kind, to figure out where the bulk of the time goes?</p>
</blockquote>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> do you want to include child processes? or just cargo itself?</p>



<a name="222199776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222199776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222199776">(Jan 10 2021 at 01:44)</a>:</h4>
<p>this is cargo itself (no <code>-f</code> flag):</p>
<div class="codehilite"><pre><span></span><code>% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 86.86    8.238082        4228      1948       956 futex
  5.40    0.512025      170675         3           wait4
  4.84    0.458704          33     13519           clock_gettime64
  0.81    0.076733          39      1944           ioctl
  0.50    0.047556         119       398        17 read
  0.46    0.043966         176       249        17 openat
  0.24    0.023097         101       227           write
  0.16    0.015232          52       291        65 statx
  0.13    0.012208         106       115           lstat64
  0.11    0.010415          67       154        66 stat64
  0.10    0.009869          82       119           mmap2
  0.09    0.008368          33       249           close
  0.06    0.005961          63        94           mprotect
  0.05    0.005192         129        40        24 access
  0.05    0.004677         275        17         3 mkdir
  0.03    0.002926          36        81           fstat64
  0.02    0.002093          38        54           getdents64
  0.02    0.002017         144        14           munmap
  0.01    0.000944         118         8           clone
  0.01    0.000843          21        39           brk
  0.01    0.000792          37        21           poll
  0.00    0.000377         377         1           rename
  0.00    0.000351         175         2           readlink
  0.00    0.000314          62         5           _llseek
  0.00    0.000279          19        14           flock
  0.00    0.000278          39         7           statfs
  0.00    0.000191          63         3         3 unlink
  0.00    0.000152          30         5           getrandom
  0.00    0.000112          14         8           rt_sigaction
  0.00    0.000080          80         1         1 restart_syscall
  0.00    0.000068          22         3           sigaltstack
  0.00    0.000042          42         1           set_tls
  0.00    0.000038          19         2           getuid32
  0.00    0.000032          32         1           sysinfo
  0.00    0.000032          16         2           geteuid32
  0.00    0.000029           4         7           rt_sigprocmask
  0.00    0.000024          24         1           getcwd
  0.00    0.000021          10         2           sched_getaffinity
  0.00    0.000000           0         1           execve
  0.00    0.000000           0         1           uname
  0.00    0.000000           0        20           ugetrlimit
  0.00    0.000000           0         4           fcntl64
  0.00    0.000000           0         1           set_tid_address
  0.00    0.000000           0         1           socket
  0.00    0.000000           0         1           socketpair
  0.00    0.000000           0         1           set_robust_list
  0.00    0.000000           0         7           pipe2
------ ----------- ----------- --------- --------- ----------------
100.00    9.484120                 19686      1152 total
</code></pre></div>



<a name="222199778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222199778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222199778">(Jan 10 2021 at 01:44)</a>:</h4>
<p>so not a ton of overhead once the index is up to date</p>



<a name="222201514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222201514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222201514">(Jan 10 2021 at 02:36)</a>:</h4>
<p>I don't have my pi on hand, but I've noticed this on both the pi3 and pi4.</p>
<p>Even a hello world is like 2 seconds to build.</p>
<p>My suspicion has always been that the "disk" access on rpi (which is generally either an SD card or a USB drive) is simply far slower to read and write than Rust seems to expect, and everything is dragged down because of it.</p>



<a name="222211778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222211778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222211778">(Jan 10 2021 at 08:10)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> I had meant the whole thing, including cargo and rustc, to find out where most of the time went. Which it looks like you ended up doing.</p>



<a name="222218343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222218343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222218343">(Jan 10 2021 at 11:35)</a>:</h4>
<p>Could be also memory issue, if things are getting swapped  those poor SD cards cannot keep up with IO.</p>



<a name="222227559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Rust%20is%20slow%20on%20raspberry%20pis/near/222227559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Rust.20is.20slow.20on.20raspberry.20pis.html#222227559">(Jan 10 2021 at 15:39)</a>:</h4>
<p>My newest Pi is 8GB of RAM and still takes a minimum of ~2 seconds to build Hello World.</p>
<p>It probably is a memory issue, but i don't think it's hitting swap on such small projects (though it could on larger projects).</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>